//
//  StepTYCyclePagerViewCell.m
//  TYCyclePagerViewDemo
//
//  Created by tany on 2017/6/14.
//  Copyright © 2017年 tany. All rights reserved.
//

#import "StepTYCyclePagerViewCell.h"

@interface StepTYCyclePagerViewCell ()
@property (nonatomic, weak) UILabel *label;
@end

@implementation StepTYCyclePagerViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        self.backgroundColor = [UIColor clearColor];
        [self addLabel];
    }
    return self;
}

- (void)addLabel
{
    ZZCACircleProgress *stepCircle = [[ZZCACircleProgress alloc]initWithFrame:SNFRAME(0, 0, 100, 100) pathBackColor:nil pathFillColor:SNCOLORBLACK startAngle:-90 strokeWidth:4];
    [self addSubview:stepCircle];
    self.stepCircle = stepCircle;
    
    UIButton *bt = [[UIButton alloc] init];
    [self addSubview:bt];

    
    _button =  bt;
    _stepCircle = stepCircle;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _button.frame = self.bounds;
    
    _stepCircle.frame = self.bounds;
    _stepCircle.showProgressText = YES;
    _stepCircle.pathFillColor = SNCOLORBLACK;
    _stepCircle.startAngle = - 90;
    _stepCircle.strokeWidth = 3;
    _stepCircle.duration         = 0.25;//动画时长
    _stepCircle.increaseFromLast = YES;
    _stepCircle.prepareToShow    = YES;
    _stepCircle.ValueLabel.textAlignment = NSTextAlignmentCenter;
    _stepCircle.unitLabel.textAlignment = NSTextAlignmentCenter;
    _stepCircle.unitLabel.center = CGPointMake(_stepCircle.ValueLabel.centerX, _stepCircle.ValueLabel.centerY + 30);
    _stepCircle.unitLabel.text = @"";
    _stepCircle.ValueLabel.font = SNSFONT(28);
    _stepCircle.unitLabel.font  = SNSFONT(13);
    _stepCircle.unitLabel.text = SN_Text(@"步数");
    _stepCircle.center = _button.center;
    _stepCircle.pointImage.image = [UIImage imageNamed:@"circle_point2"];
}

@end
